/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package day06;

/**
 *
 * @author Administrator
 */
public class Circle extends AShape implements ICalculator{
    private double radius;

    public Circle(APoint apoint, String color, double radius) {
        super(apoint, color);
        this.radius = radius;
    }
    /*
     * Dien tich
     */

    @Override
    public double dientich() {
        return Math.pow(radius, 2) * Math.PI;
    }
    /*
     * Chu vi
     */
    @Override
    public double chuvi(){
        return this.radius * 2 * Math.PI;
    
    }
 /*
  * toString
  */   
    @Override
    public String toString(){
        return "Circle = "+this.apoint + ","+ this.color + ", "+ this.radius;
        
    }

    @Override
    public double distanceFromPointToPoint(APoint a) {
        int xAB = Math.abs(a.getX() - this.apoint.getX());        
        int yAB = Math.abs(a.getY() - this.apoint.getY());
        double powXAB = Math.pow(xAB, 2); 
        double powYAB = Math.pow(yAB,2);        
        return Math.sqrt(powXAB+powYAB);
    }
}
